Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haddocks for certain aspects of the HFC status quo #428

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

amesgen
Copy link
Member

@amesgen amesgen commented Oct 12, 2023

Related to #420, in particular #413 and #345

@amesgen
Copy link
Member Author

amesgen commented Oct 12, 2023

I can split out the first commit if desired

Comment on lines 19 to 39
data EraTranslation xs = EraTranslation {
-- | For each pair @(x, y)@ of subsequent eras, describe how to construct
-- the initial ledger state for @y@ from the last ledger state in @x@.
--
-- When ticking across an era boundary, the HFC will first invoke this and
-- then tick the resulting ledger state (in @y@) to the requested slot.
--
-- The resulting ledger state must summarize every relevant aspect of what
-- came before the new era. This is intentionally vague; for example,
-- ticking in @y@ might work rather differntly than in @x@, and so certain
-- aspects of the ticking logic of @x@ might need to happen as part of
-- 'translateLedgerState'. For a concrete example in Cardano, see
-- 'translateLedgerStateBabbageToConwayWrapper'.
translateLedgerState :: InPairs (RequiringBoth WrapLedgerConfig (Translate LedgerState)) xs
-- | For each pair @(x, y)@ of subsequent eras, describe how to construct
-- the initial chain-dependent state for @y@ from the last chain-dep state
-- in @x@.
--
-- When ticking across an era boundary, the HFC will first invoke this and
-- then tick the resulting chain-dep state (in @y@) to the requested slot.
, translateChainDepState :: InPairs (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState)) xs
Copy link
Member Author

@amesgen amesgen Oct 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to rename these? I am a bit unsure whether sth like constructInitialLedgerState is really more clear, but OTOH, translateLedgerState is maybe too generic?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be in favor of renaming this to something more clear, that conveys not only in what context this will be used (as it is now with translateX) but also what it actually does (as it is in your proposed constructInitialLedgerState).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I also think renaming to something much more concrete than "translate" is important.

Copy link
Contributor

@nfrisby nfrisby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm Requesting Changes because:

  • I don't think we should delay renaming the translate* functions.
  • I think we can eliminate some ambiguity in the new Haddock.
  • The above renaming reminded me about the Ouroboros.Consensus.Protocol.Translate module; I figure it needs the same treatment you're giving CanHardFork here.

--
-- with inequality exactly if we ticked across an era boundary.
--
-- == Ticking alone can't reveal era transitions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wording of this subheading seems off to me:

Ticking alone can't reveal era transitions

It seems like there are two things worth explaining/referencing:

  • The transition must have been predicted by singleEraTransition at least one safe zone before it happened.

  • Ticking is currently unable to change the output of singleEraTransition.

Right now, the text of this subheading could be interpreted as either of those two things. Is that ambiguity intentional?

Also, the text seems to call the first one a "reflection" of the second one, which I hesitate to agree with.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ticking is currently unable to change the output of singleEraTransition.

This is what I wanted to talk about here in this subsection, but I didn't phrase it like this as you can't apply singleEraTransition to the output of ticking.

I didn't intend to talk about safe zones here (but that could definitely happen in a different subsection, will add that 👍). In my mind, these two topics are orthogonal:

  • This subsection is about how era transitions can become known (currently, only via block application, not via ticking).
  • Safe zones are about when an era transition can become known.

Also, the text seems to call the first one a "reflection" of the second one, which I hesitate to agree with.

Yeah, I didn't want to imply that, hopefully, separating safe zones to its own section will make that more clear.

Comment on lines 19 to 39
data EraTranslation xs = EraTranslation {
-- | For each pair @(x, y)@ of subsequent eras, describe how to construct
-- the initial ledger state for @y@ from the last ledger state in @x@.
--
-- When ticking across an era boundary, the HFC will first invoke this and
-- then tick the resulting ledger state (in @y@) to the requested slot.
--
-- The resulting ledger state must summarize every relevant aspect of what
-- came before the new era. This is intentionally vague; for example,
-- ticking in @y@ might work rather differntly than in @x@, and so certain
-- aspects of the ticking logic of @x@ might need to happen as part of
-- 'translateLedgerState'. For a concrete example in Cardano, see
-- 'translateLedgerStateBabbageToConwayWrapper'.
translateLedgerState :: InPairs (RequiringBoth WrapLedgerConfig (Translate LedgerState)) xs
-- | For each pair @(x, y)@ of subsequent eras, describe how to construct
-- the initial chain-dependent state for @y@ from the last chain-dep state
-- in @x@.
--
-- When ticking across an era boundary, the HFC will first invoke this and
-- then tick the resulting chain-dep state (in @y@) to the requested slot.
, translateChainDepState :: InPairs (RequiringBoth WrapConsensusConfig (Translate WrapChainDepState)) xs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I also think renaming to something much more concrete than "translate" is important.

@nfrisby nfrisby mentioned this pull request Jan 10, 2024
5 tasks
@dnadales dnadales mentioned this pull request Jan 24, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants